#ifndef D3D9RENDERER_H
#define D3D9RENDERER_H

#include <Windows.h>
#include <xnamath.h>

#include <d3d9.h>
#include <d3dx9.h>

struct TLVERTEX
{
	float x;
	float y;
	float z;
	D3DCOLOR color;
	float u;
	float v;
};

class D3D9Renderer
{
public:
	D3D9Renderer();
	D3D9Renderer(const D3D9Renderer&){};
	~D3D9Renderer(){};

	static bool Initialize(HWND _hwnd, bool _fullscreen, bool _vsync, int _horizontalRes, int _verticalRes);
	static void Clear(DWORD _count, const D3DRECT* _rectsptr, DWORD _flags, D3DCOLOR _clearColor, float _clearDepth, DWORD _clearStencil);
	static void BeginScene();
	static void BeginSprite();
	static void EndSprite();
	static void EndScene();
	static void Present(const RECT* _sourceRectPtr, const RECT* _destRectPtr, HWND _hDestWindow, const RGNDATA* _dirtyRegionPtr);
	static void Shutdown();
	static void SetupQuad();
	static void ResetDevice();

	static D3DXMATRIX matOrtho;
	static D3DXMATRIX matIdentity;

	static D3DPRESENT_PARAMETERS pp;
	static IDirect3D9* d3d;
	static IDirect3DDevice9* device;
	static LPD3DXSPRITE spriteDevice;
	static ID3DXEffectPool* effectPool;
	static HWND hwnd;

	static IDirect3DVertexBuffer9* vertexBuffer;

	static DWORD D3DFVF_TLVERTEX;
};

#endif